# -*- coding: utf-8 -*-

from sqlalchemy import Column, String,Integer,DateTime, create_engine,ForeignKey
from sqlalchemy.orm import sessionmaker,relationship
from sqlalchemy.ext.declarative import declarative_base

# 创建对象的基类:
Base = declarative_base()

class Log(Base):
    __tablename__ = 'log'
    id = Column(Integer,primary_key=True)

    wid = Column(String,unique=True)#出款单号

    name = Column(String)
    account = Column(String)
    money = Column(Integer)
    create_time = Column(DateTime)

    is_lock = Column(Integer,default=0)
    is_commit = Column(Integer,default=0)
    last_update_time = Column(DateTime)

    user_account = Column(String)

class ExceptionLog(Base):
    __tablename__ = 'exception_log'
    id = Column(Integer,primary_key=True)

    exception_class = Column(String)
    exception_message = Column(String)
    exception_wid = Column(String,unique=True)#出款单号
        

engine = create_engine("sqlite:///pay_log.db", echo=True)
DBSessionMaker = sessionmaker(bind=engine)
Base.metadata.create_all(engine)
session=DBSessionMaker()